package com.ruoyi.mall.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mall.mapper.MallDistributionConfigMapper;
import com.ruoyi.mall.domain.MallDistributionConfig;
import com.ruoyi.mall.service.IMallDistributionConfigService;

/**
 * 分销设置Service业务层处理
 *
 * @author ruoyi
 * @date 2022-02-25
 */
@Service
public class MallDistributionConfigServiceImpl implements IMallDistributionConfigService
{
    @Autowired
    private MallDistributionConfigMapper mallDistributionConfigMapper;

    /**
     * 查询分销设置
     *
     * @param id 分销设置主键
     * @return 分销设置
     */
    @Override
    public MallDistributionConfig selectMallDistributionConfigById(Long id)
    {
        return mallDistributionConfigMapper.selectMallDistributionConfigById(id);
    }

    /**
     * 查询分销设置列表
     *
     * @param mallDistributionConfig 分销设置
     * @return 分销设置
     */
    @Override
    public List<MallDistributionConfig> selectMallDistributionConfigList(MallDistributionConfig mallDistributionConfig)
    {
        return mallDistributionConfigMapper.selectMallDistributionConfigList(mallDistributionConfig);
    }

    /**
     * 新增分销设置
     *
     * @param mallDistributionConfig 分销设置
     * @return 结果
     */
    @Override
    public int insertMallDistributionConfig(MallDistributionConfig mallDistributionConfig)
    {
        mallDistributionConfig.setCreateTime(DateUtils.getNowDate());
        return mallDistributionConfigMapper.insertMallDistributionConfig(mallDistributionConfig);
    }

    /**
     * 修改分销设置
     *
     * @param mallDistributionConfig 分销设置
     * @return 结果
     */
    @Override
    public int updateMallDistributionConfig(MallDistributionConfig mallDistributionConfig)
    {
        mallDistributionConfig.setUpdateTime(DateUtils.getNowDate());
        return mallDistributionConfigMapper.updateMallDistributionConfig(mallDistributionConfig);
    }

    /**
     * 批量删除分销设置
     *
     * @param ids 需要删除的分销设置主键
     * @return 结果
     */
    @Override
    public int deleteMallDistributionConfigByIds(Long[] ids)
    {
        return mallDistributionConfigMapper.deleteMallDistributionConfigByIds(ids);
    }

    /**
     * 删除分销设置信息
     *
     * @param id 分销设置主键
     * @return 结果
     */
    @Override
    public int deleteMallDistributionConfigById(Long id)
    {
        return mallDistributionConfigMapper.deleteMallDistributionConfigById(id);
    }

    @Override
    public MallDistributionConfig findMallDistributionConfig() {
        return mallDistributionConfigMapper.findMallDistributionConfig();
    }
}
